<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    for (var i=1; i<=7; i++) {
      var str = '';
      if (i<=4) {
        for (var j=1; j<=7; j++) {
          if (j>=5-i && j<=3+i) {
            str += '*';
          } else {
            str += ' ';
          }
        }
      } else {
        for (var k=1; k<=7; k++) {
          if (k>=i-3 && k<=11-i) {
            str += '*';
          } else {
            str += ' ';
          }
        }
      }
      console.log(str);
    }
  </script>
</body>
</html>